﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;

/// <summary>
/// WebPageUtil 的摘要描述
/// </summary>
/// 

namespace com.pro2e.web.util.page
{
    public class WebPageUtil
    {

        /// <summary>
        /// 產生控制項的Html
        /// </summary>
        /// <param name="ControlToRender">要輸出的控制項</param>
        /// <returns>html碼</returns>
        public static string RenderControlToHtml(Control ControlToRender)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            System.IO.StringWriter stWriter = new System.IO.StringWriter(sb);
            System.Web.UI.HtmlTextWriter htmlWriter = new System.Web.UI.HtmlTextWriter(stWriter);
            ControlToRender.RenderControl(htmlWriter); return sb.ToString();
        }
        /// <summary>
        /// 去除空白字元
        /// </summary>
        /// <param name="text">要去除的文字內容</param>
        /// <returns>文字內容</returns>
        public static string Scrub(string text) { return text.Replace("&nbsp;", ""); }
    }
}